<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Checks if the given hash matches the given options</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.password-hash.html">password_hash</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.password-verify.html">password_verify</a></div>
 <div class="up"><a href="ref.password.html">Password Hashing 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.password-needs-rehash" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">password_needs_rehash</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0)</p><p class="refpurpose"><span class="refname">password_needs_rehash</span> &mdash; <span class="dc-title">Checks if the given hash matches the given options</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.password-needs-rehash-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">boolean</span> <span class="methodname"><strong>password_needs_rehash</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$hash</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$algo</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$options</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   This function checks to see if the supplied hash implements the algorithm
   and options provided. If not, it is assumed that the hash needs to be
   rehashed.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.password-needs-rehash-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">hash</code></em></dt>

    <dd>

     <p class="para">
      一个由 <span class="function"><a href="function.password-hash.html" class="function">password_hash()</a></span> 创建的散列值。
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">algo</code></em></dt>

    <dd>

     <p class="para">
      一个用来在散列密码时指示算法的<a href="password.constants.html" class="link">密码算法常量</a>。
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">options</code></em></dt>

    <dd>

     <p class="para">
      一个包含有选项的关联数组。目前支持两个选项：<em>salt</em>，在散列密码时加的盐（干扰字符串），以及<em>cost</em>，用来指明算法递归的层数。这两个值的例子可在 <span class="function"><a href="function.crypt.html" class="function">crypt()</a></span> 页面找到。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.password-needs-rehash-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> if the hash should be rehashed to match the given
   <em><code class="parameter">algo</code></em> and <em><code class="parameter">options</code></em>, or <strong><code>FALSE</code></strong>
   otherwise.
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.password-hash.html">password_hash</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.password-verify.html">password_verify</a></div>
 <div class="up"><a href="ref.password.html">Password Hashing 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
